package org.cometmi.gwt.echo3.server;

import org.apache.log4j.Logger;
import org.cometmi.gwt.server.events.BoxEvent;
import org.cometmi.gwt.server.events.BoxEventHandler;
import org.cometmi.gwt.shared.MiQueue;
import org.cometmi.gwt.shared.events.BindCallback;
import org.cometmi.gwt.shared.exceptions.NameParseException;
import org.cometmi.gwt.shared.exceptions.NotAllowedQueueException;

public class Startup implements BoxEventHandler
{
	static protected Logger logger = Logger.getLogger(Startup.class);

	@Override
	public void onInitialize(BoxEvent event)
	{
		try
		{
			MiQueue queue = event.getQueue("org.cometmi.gwt.test.echo3.server");

			queue.bind("___id", new ServerTestObjImpl(), new BindCallback()
			{
				@Override
				public void onSuccess()
				{}

				@Override
				public void onError(Throwable t)
				{
					logger.error("[Startup] error:", t);
				}
			});
		}
		catch (NameParseException e)
		{}
		catch (NotAllowedQueueException e)
		{}
	}
}
